from flask import Flask
import config
from exts import db
from flask_migrate import Migrate
from models import UserModel, ObjectModel
from user import bp as user_bp
from object import bp as object_bp
# from flask_wtf import CSRFProtect

app = Flask(__name__)

app.config.from_object(config)
#设置json格式
app.config['JSON_AS_ASCII'] = False

db.init_app(app)

migrate = Migrate(app, db, render_as_batch=True, compare_type=True)
# csrf = CSRFProtect()

app.register_blueprint(user_bp)
app.register_blueprint(object_bp)

# csrf.init_app(app)
WTF_CSRF_CHECK_DEFAULT = False

# 创建路由和视图函数的映射
@app.route("/")
def route():
    return "Hello world"

if __name__ == '__main__':
    app.run(debug=True, host='0.0.0.0')